package edu.hawaii.wicket.page.security;

import java.util.Map;
import org.apache.wicket.ResourceReference;
import org.apache.wicket.markup.html.basic.Label;
import org.apache.wicket.markup.html.form.Form;
import org.apache.wicket.markup.html.image.Image;
import org.apache.wicket.markup.html.link.Link;
import org.apache.wicket.model.Model;
import edu.hawaii.wicket.ExampleApplicationSession;
import edu.hawaii.wicket.page.BasePage;
import edu.hawaii.wicket.page.ac.ACPage;
import edu.hawaii.wicket.page.aquaponics.AquaponicsPage;
import edu.hawaii.wicket.page.lighting.LightingPage;
import edu.hawaii.wicket.page.water.WaterPage;
/**
 * Creates the security page.
 * @author Gregory L Burgess
 *
 */
public class SecurityPage extends BasePage {
   
   private static final ResourceReference SIDE_BAR = new ResourceReference(
            SecurityPage.class,"side-bar.png");
   private static final ResourceReference LOGO = new ResourceReference(
            SecurityPage.class,"logo.png");
    
   private static final long serialVersionUID = 1L;
   /**
    * Creates the security page. 
    */
   public SecurityPage() { 

     add(new Image("sidebar", new Model<ResourceReference>(SIDE_BAR)));
     add(new Image("logo", new Model<ResourceReference>(LOGO)));

     ResourceReference house = new ResourceReference(SecurityPage.class,
         "security_chart.png");
     add(new Image("house", new Model<ResourceReference>(house)));
  
     //form to pass data
     Form<String> form = new Form<String>("form");
     add(form);

     ResourceReference key = new ResourceReference(SecurityPage.class,"Keypad.png");
     form.add(new Image("keypad", new Model<ResourceReference>(key)));
     //System status
     form.add(new Label("status", "ARMED"));
     
    
     
     //=========================================================================================
   //=========================================================================================
   //=========================================================================================
   //=========================================================================================
  // Now add the links that go in the tabs. 
     add(new Link<String>("AquaponicsPageLink") {
       private static final long serialVersionUID = 1L;
       /** Upon clicking this link, go to HomePage. */
       @Override
       public void onClick() {
         setResponsePage(new AquaponicsPage());
       }
       }
     );
     
     add(new Link<String>("LightingPageLink") {
       private static final long serialVersionUID = 1L;
       /** Upon clicking this link, go to ListPage. */
       @Override
       public void onClick() {
         setResponsePage(new LightingPage());
       } 
       }
     );
     
     add(new Link<String>("SecurityPageLink") {
       private static final long serialVersionUID = 1L;
       /** Upon clicking this link, go to FormPage. */
       @Override
       public void onClick() {
         setResponsePage(new SecurityPage());
       }
       }
     );
     
     add(new Link<String>("ClimatePageLink") {
       private static final long serialVersionUID = 1L;
       /** Upon clicking this link, go to TablePage. */
       @Override
       public void onClick() {
         setResponsePage(new ACPage());
       }
       }
     );
     
     add(new Link<String>("WaterPageLink") {
       private static final long serialVersionUID = 1L;
       /** Upon clicking this link, go to TablePage. */
       @Override
       public void onClick() {
         setResponsePage(new WaterPage());
       }
       }
     );
     
  }
   
   /**
    * Returns the property map associated with this user's session.
    * @return The session's property map.
    */
   public Map<String, String> getSessionProperties() {
     return ((ExampleApplicationSession)getSession()).getProperties();   
   }
 }

